﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>模块管理</title>
    <link rel="stylesheet" href="@ViewBag.easyuiTheme" id="easyuiTheme" />
    <link rel="stylesheet" href="@Url.Content("~/Content/list.css")" />
    @Styles.Render("~/style-easyui")
</head>
<body class="easyui-layout">
    <div data-options="region:'north',border:false,split:false" style="height:30px;" id="datahead">
    </div>
    <div data-options="region:'center',border:false">
        <table id="tt"></table>
    </div>
    <div class="searchbox">
        <div>
            <input id="txt_ModuleID" type="text" class="easyui-textbox" label="模块ID：" />
        </div>
        <div>
            <input id="txt_ModuleName" type="text" class="easyui-textbox" label="模块名称：" />
        </div>
        <div>
            <input id="txt_WebURL" type="text" class="easyui-textbox" label="路径：" />
        </div>
    </div>
    <div id="infoDialog"></div>
    <div id="dlg-buttons">
        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:alert('save')">Save</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:$('#dlg').dialog('close')">Close</a>
    </div>

    @Scripts.Render("~/script-easyui")
    <script type="text/javascript" src="@Url.Content("~/Scripts/public.js")"></script>
    <script type="text/javascript">

        $(function () {
            initGrid();
            initSearchBar();
        });

        function initGrid() {
            $("#tt").initGrid({
                url: '/Module/InitGrid',
                queryParams: {
                    Search: encodeURI($.trim($("#txt_Search").val())),
                    ModuleID: encodeURI($.trim($("#txt_ModuleID").val())),
                    ModuleName: encodeURI($.trim($("#txt_ModuleName").val())),
                    WebURL: encodeURI($.trim($("#txt_WebURL").val()))
                },
                columns: [[
                    { field: 'ck', checkbox: true, width: 50 },
                    { field: 'ModuleID', title: '模块ID', width: 60, sortable: true },
                    { field: 'ModuleName', title: '模块名称', width: 120, sortable: true },
                    { field: 'WebURL', title: '路径', width: 220, sortable: true },
                    { field: 'IsSys', title: '系统模块', width: 50, sortable: true, align: 'center' },
                    { field: 'action', title: '操作', width: 60, align: 'center' },
                ]],
                sortName: "ModuleID",
                sortOrder: "desc",
            });
        }

        function initSearchBar() {
            $("#datahead").initSearchBar({
                title: "@ViewBag.Title",
                buttonList: [],
                btnAddcallback: function () { setInfo(); },
                btnDelcallback: function () { $("#tt").deleteCallBack({ idValue: "ModuleID", action: "/Module/Delete" }) }
            });
        }

        function setInfo(ModuleID) {
            var title = ModuleID == undefined ? "新增模块" : "修改模块";
            $('#infoDialog').dialog({
                title: title,
                width: 600,
                height: 380,
                closed: false,
                cache: false,
                href: 'Info'
            });
        }

    </script>
</body>
</html>
